<template>
  <div class="hotel-list-item">
    <router-link :to="{
      path: '/detail',
      query: {
        id: data.id,
        field: 'hotel',
      }
    }">
      <div class="img">
        <img :src="data.img" alt="">
      </div>
      <!-- 图文信息 -->
      <div class="img-introduce">
        <div class="name-wrap">
          <span class="name">{{data.name}}</span>
        </div>
        <div class="score-wrap">
          <span class="score">{{data.score}}分</span>
        </div>
        <div class="area-wrap">
          <span class="area">{{data.area}}</span>
        </div>
        <div class="price-addres-wrap">
          <span class="price">
            ￥{{data.default_price}}
          </span>
          <span class="address">
            {{data.city_name}}
          </span>
        </div>
      </div>
    </router-link>
  </div>
</template>

<script>
export default {
  name: 'HotelListItem',
  props: {
    data: {
      type: Object,
      default () {
        return {};
      }
    }
  }
} 
</script>

<style lang="scss" scoped>
@import '@/assets/style/mixins.scss';
@import '@/assets/style/variables.scss';
.hotel-list-item {
  box-sizing: border-box;
  width: 100%;
  height: 1.2rem;
  padding: .1rem;
  margin-top: 1px;
  background-color: #fff;
  a {
    display: flex;
    width: 100%;
    height: 100%;
    .img {
      width: 1.1rem;
      box-sizing: border-box;
      padding-right: .1rem;
      img {
        width: 100%;
        height: 100%;
      }
    }
    .img-introduce {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      height: 100%;
      .name-wrap {
        width: 100%;
        font-size: .20rem;
        font-weight: bold;
        span {
          display: inline-block;
          max-width: 2.45rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        }
      }
      .score-wrap {
        width: 100%;
        font-size: .16rem;
        color: $starColor;
        
      }
      .area-wrap {
        display: inline-block;
          max-width: 2.35rem;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
        font-size: .16rem;
        color: #aaa;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .price-addres-wrap {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        .price {
          color: $defaultGreen;
          font-size: .18rem;
          font-weight: bold;
        }
        .address {
          font-size: .16rem;
          font-weight: bold;
        }
      }
    }
  }
}
</style>